<script setup lang="ts">
import HeaderMenuWhite from "~/components/base/HeaderMenuWhite.vue";
import Footer from "~/components/base/Footer.vue";
import OccupationItem from "~/components/OccupationItem.vue";
import PlatformItem from "~/components/PlatformItem.vue";
import AsBuyerItem from "~/components/AsBuyerItem.vue";
import { useUserStore } from "~/store/useUser";
import { ElMessage } from "element-plus";

// Nuxt SEO Meta
useSeoMeta({
  title: "成为卖家 - 技能猴子",
  ogTitle: "成为卖家 - 技能猴子",
  description: "技能猴子，找技能服务，我喜欢和技能人才直接聊",
  ogDescription: "技能猴子，找技能服务，我喜欢和技能人才直接聊",
});

const userStore = useUserStore();
const router = useRouter();

// 成为卖家功能
const becomeSeller = () => {
  // 检查用户是否已登录
  if (!userStore.isLogin) {
    ElMessage.warning('请先登录后再成为卖家');
    router.push({
      path: '/login',
      query: { redirect: '/createUser' }
    });
    return;
  }
  
  // 跳转到卖家入驻引导页面
  navigateTo('/createUser');
};
</script>

<template>
  <HeaderMenuWhite bg-color="transparent" />
  <div class="seller-registration">
    <div class="top">
      <div class="top-title">
        <img class="logo" src="~/assets/web-logo.png" alt="" />
        <h2>加速工作向远程技能交易转变</h2>
        <h2>让人们可以在任何地方自由的工作与生活</h2>
        <button class="to-m" @click="becomeSeller"
          >成为卖家</button
        >
        <div class="down-to">
          <div class="mouse">
            <span></span>
          </div>
          <span>下滑即刻体验</span>
        </div>
      </div>
      <div class="top-data">
        <div class="top-data-box">
          <div class="data-item">
            <span class="num">327 <span>个城市</span></span>
            <p class="tip">技能猴子卖家分布于全球</p>
          </div>
          <span class="line"></span>
          <div class="data-item">
            <span class="num">400,000<span>+</span></span>
            <p class="tip">技能猴子卖家分布于全球</p>
          </div>
          <span class="line"></span>
          <div class="data-item">
            <span class="num">98 <span>%</span></span>
            <p class="tip">技能猴子卖家分布于全球</p>
          </div>
        </div>
      </div>
    </div>
    <div class="occupation">
      <div class="occupation-box">
        <span class="title">作为同行 <span>FREE WORKING</span></span>
        <p class="title-tips">他们，已在技能猴子开启自由工作新航程！</p>
        <div class="occupation-list">
          <OccupationItem />
          <OccupationItem />
          <OccupationItem />
          <OccupationItem />
          <OccupationItem />
          <OccupationItem />
        </div>
      </div>
    </div>
    <div class="occupation">
      <div class="occupation-box">
        <span class="title">作为买家 <span>SERVICE</span></span>
        <p class="title-tips">他们，对你的服务充满期待！</p>
        <div class="occupation-list">
          <AsBuyerItem />
          <AsBuyerItem />
          <AsBuyerItem position="right" />
          <AsBuyerItem position="right" />
        </div>
      </div>
    </div>
    <div class="occupation">
      <div class="occupation-box">
        <span class="title">技能猴子<span>PLATFORM</span></span>
        <p class="title-tips">专业的技能电商平台</p>
        <div class="platform-list">
          <PlatformItem />
          <PlatformItem />
          <PlatformItem />
        </div>
      </div>
    </div>
    <div class="find-ability">
      <h3>我要加入<span>技能猴子</span>，成为<span>卖家！</span></h3>
      <h4>立即注册并创建您的第一个技能</h4>
      <button @click="becomeSeller">成为卖家</button>
    </div>
  </div>
  <Footer />
</template>

<style scoped lang="scss">
.seller-registration {
  width: 100%;
  overflow-x: hidden;
}

.top {
  width: 100%;
  height: 100vh;
  min-height: 600px;
  background: url("~/assets/seller-registration-bg.png") no-repeat;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 20px;
}

.top-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: -100px;
  text-align: center;
  max-width: 100%;
  
  .logo {
    width: 178px;
    height: 60px;
    margin-bottom: 12px;
    max-width: 100%;
    height: auto;
  }
  
  h2 {
    font-size: 54px;
    color: #ffffff;
    line-height: 1.4;
    margin: 0;
    padding: 0 10px;
  }
  
  .to-m {
    margin-top: 32px;
    width: 128px;
    height: 44px;
    background: #1dbf73;
    border-radius: 8px;
    text-align: center;
    line-height: 44px;
    color: #fff;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    &:hover {
      background: #17a863;
    }
  }
  
  .down-to {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 168px;
    left: 0;
    
    .mouse {
      width: 22px;
      height: 32px;
      border-radius: 8px;
      border: 2px solid #ffffff;
      display: flex;
      align-items: center;
      justify-content: center;
      
      span {
        display: inline-block;
        width: 0;
        height: 8px;
        background: #1dbf73;
        border: 2px solid #1dbf73;
        animation: down-to 2s infinite;
        position: relative;
        top: -7px;
      }
    }
    
    span {
      font-size: 12px;
      color: #ffffff;
      margin-top: 8px;
    }
  }
}

// 平板适配 (768px - 1024px)
@media (max-width: 1024px) {
  .top-title {
    margin-top: -50px;
    
    .logo {
      width: 150px;
      height: 50px;
    }
    
    h2 {
      font-size: 42px;
      line-height: 1.3;
    }
    
    .to-m {
      width: 120px;
      height: 40px;
      line-height: 40px;
      font-size: 15px;
    }
  }
  
  .top-title .down-to {
    bottom: 140px;
  }
}

// 手机适配 (最大768px)
@media (max-width: 768px) {
  .top {
    min-height: 500px;
    padding: 0 15px;
  }
  
  .top-title {
    margin-top: 0;
    
    .logo {
      width: 120px;
      height: 40px;
      margin-bottom: 20px;
    }
    
    h2 {
      font-size: 28px;
      line-height: 1.2;
      margin-bottom: 10px;
    }
    
    .to-m {
      margin-top: 24px;
      width: 110px;
      height: 38px;
      line-height: 38px;
      font-size: 14px;
    }
    
    .down-to {
      bottom: 100px;
      
      .mouse {
        width: 18px;
        height: 28px;
        
        span {
          height: 6px;
        }
      }
      
      span {
        font-size: 11px;
      }
    }
  }
}

// 小屏手机适配 (最大480px)
@media (max-width: 480px) {
  .top-title {
    h2 {
      font-size: 22px;
      padding: 0 5px;
    }
    
    .logo {
      width: 100px;
      height: 34px;
    }
    
    .to-m {
      width: 100px;
      height: 36px;
      line-height: 36px;
      font-size: 13px;
    }
  }
}
@keyframes down-to {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
  100% {
    transform: translateY(0);
  }
}

// 通用响应式优化
* {
  box-sizing: border-box;
}

// 确保图片响应式
img {
  max-width: 100%;
  height: auto;
}

// 超大屏幕适配 (1440px+)
@media (min-width: 1440px) {
  .occupation-box {
    max-width: 1400px;
  }
  
  .top-data-box {
    max-width: 1000px;
  }
}

// 超小屏幕适配 (320px - 480px)
@media (max-width: 320px) {
  .top {
    padding: 0 10px;
  }
  
  .top-title {
    h2 {
      font-size: 18px;
      line-height: 1.2;
    }
    
    .logo {
      width: 80px;
      height: 28px;
    }
    
    .to-m {
      width: 90px;
      height: 32px;
      line-height: 32px;
      font-size: 12px;
    }
  }
  
  .top-data {
    height: 80px;
    padding: 0 10px;
    
    .top-data-box {
      .data-item {
        .num {
          font-size: 18px;
          
          span {
            font-size: 9px;
          }
        }
        
        .tip {
          font-size: 10px;
        }
      }
      
      .line {
        height: 20px;
        margin: 0 5px;
      }
    }
  }
  
  .occupation {
    padding: 0 10px;
    
    .occupation-box {
      padding-top: 25px;
      
      .title {
        font-size: 18px;
        line-height: 26px;
        
        span {
          font-size: 26px;
          width: 200px;
          top: -10px;
        }
      }
      
      .title-tips {
        font-size: 18px;
        margin-bottom: 12px;
      }
    }
  }
  
  .find-ability {
    min-height: 180px;
    padding: 20px 10px;
    
    h3 {
      font-size: 20px;
    }
    
    h4 {
      font-size: 16px;
    }
    
    button {
      width: 120px;
      height: 36px;
      font-size: 12px;
    }
  }
}
.top-data {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  width: 100%;
  left: 0;
  bottom: 0;
  background: RGBA(25, 31, 32, 1);
  height: 136px;
  padding: 0 20px;
  
  .top-data-box {
    width: 100%;
    max-width: 800px;
    display: flex;
    align-items: center;
    color: #ffffff;
    justify-content: space-between;
    
    .data-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      flex: 1;
      
      .num {
        font-size: 32px;
        color: #1dbf73;
        font-weight: 600;
        margin-bottom: 6px;
        
        span {
          font-size: 14px;
        }
      }
      
      .tip {
        font-size: 14px;
        text-align: center;
        line-height: 1.3;
      }
    }
    
    .line {
      width: 1px;
      height: 40px;
      background: rgba(255, 255, 255, 0.16);
      margin: 0 20px;
    }
  }
}

// 平板适配
@media (max-width: 1024px) {
  .top-data {
    height: 120px;
    
    .top-data-box {
      .data-item {
        .num {
          font-size: 28px;
          
          span {
            font-size: 12px;
          }
        }
        
        .tip {
          font-size: 13px;
        }
      }
      
      .line {
        height: 35px;
        margin: 0 15px;
      }
    }
  }
}

// 手机适配
@media (max-width: 768px) {
  .top-data {
    height: 100px;
    padding: 0 15px;
    
    .top-data-box {
      .data-item {
        .num {
          font-size: 24px;
          margin-bottom: 4px;
          
          span {
            font-size: 11px;
          }
        }
        
        .tip {
          font-size: 12px;
          padding: 0 5px;
        }
      }
      
      .line {
        height: 30px;
        margin: 0 10px;
      }
    }
  }
}

// 小屏手机适配
@media (max-width: 480px) {
  .top-data {
    height: 90px;
    
    .top-data-box {
      .data-item {
        .num {
          font-size: 20px;
          
          span {
            font-size: 10px;
          }
        }
        
        .tip {
          font-size: 11px;
          padding: 0 2px;
        }
      }
      
      .line {
        height: 25px;
        margin: 0 8px;
      }
    }
  }
}
.occupation {
  background: #fff;
  padding: 0 20px;
  
  .occupation-box {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 60px;
    
    .title {
      font-size: 32px;
      font-weight: 600;
      position: relative;
      color: rgba(29, 191, 115, 1);
      line-height: 48px;
      
      span {
        position: absolute;
        top: -20px;
        left: 0;
        width: 400px;
        z-index: 0;
        color: rgba(19, 84, 78, 0.04);
        font-size: 48px;
      }
    }
    
    .title-tips {
      color: rgba(25, 30, 40, 1);
      font-size: 32px;
      font-weight: 600;
      margin-bottom: 24px;
      line-height: 1.3;
    }
  }
}

// 平板适配
@media (max-width: 1024px) {
  .occupation {
    padding: 0 30px;
    
    .occupation-box {
      padding-top: 50px;
      
      .title {
        font-size: 28px;
        line-height: 42px;
        
        span {
          font-size: 42px;
          width: 350px;
          top: -18px;
        }
      }
      
      .title-tips {
        font-size: 28px;
        margin-bottom: 20px;
      }
    }
  }
}

// 手机适配
@media (max-width: 768px) {
  .occupation {
    padding: 0 20px;
    
    .occupation-box {
      padding-top: 40px;
      
      .title {
        font-size: 24px;
        line-height: 36px;
        
        span {
          font-size: 36px;
          width: 300px;
          top: -15px;
        }
      }
      
      .title-tips {
        font-size: 24px;
        margin-bottom: 18px;
      }
    }
  }
}

// 小屏手机适配
@media (max-width: 480px) {
  .occupation {
    padding: 0 15px;
    
    .occupation-box {
      padding-top: 30px;
      
      .title {
        font-size: 20px;
        line-height: 30px;
        
        span {
          font-size: 30px;
          width: 250px;
          top: -12px;
        }
      }
      
      .title-tips {
        font-size: 20px;
        margin-bottom: 15px;
      }
    }
  }
}
.occupation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

// 作为同行部分 - 一行三列布局
.occupation:nth-child(2) .occupation-list {
  justify-content: space-between;
  
  // 每行显示3个项目
  > * {
    flex: 0 0 calc(33.333% - 14px);
    max-width: calc(33.333% - 14px);
  }
}

// 成为买家部分 - 一行两列布局  
.occupation:nth-child(3) .occupation-list {
  justify-content: space-between;
  
  // 每行显示2个项目
  > * {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
  }
}

.platform-list {
  display: flex;
  justify-content: space-between;
  padding: 0 80px 60px;
  gap: 20px;
  flex-wrap: wrap;
}

// 平板适配
@media (max-width: 1024px) {
  .occupation-list {
    gap: 15px;
  }
  
  // 作为同行部分在平板上改为两列
  .occupation:nth-child(2) .occupation-list {
    > * {
      flex: 0 0 calc(50% - 8px);
      max-width: calc(50% - 8px);
    }
  }
  
  // 成为买家部分保持两列但调整间距
  .occupation:nth-child(3) .occupation-list {
    > * {
      flex: 0 0 calc(50% - 8px);
      max-width: calc(50% - 8px);
    }
  }
  
  .platform-list {
    padding: 0 40px 50px;
    gap: 15px;
  }
}

// 手机适配
@media (max-width: 768px) {
  .occupation-list {
    gap: 12px;
    justify-content: center;
  }
  
  // 手机端所有部分都改为单列布局
  .occupation:nth-child(2) .occupation-list,
  .occupation:nth-child(3) .occupation-list {
    flex-direction: column;
    align-items: center;
    
    > * {
      flex: 0 0 auto;
      max-width: 100%;
      width: 100%;
      max-width: 400px; // 限制最大宽度
    }
  }
  
  .platform-list {
    padding: 0 20px 40px;
    gap: 12px;
    justify-content: center;
  }
}

// 小屏手机适配
@media (max-width: 480px) {
  .occupation-list {
    gap: 10px;
  }
  
  // 小屏手机继续保持单列布局
  .occupation:nth-child(2) .occupation-list,
  .occupation:nth-child(3) .occupation-list {
    > * {
      max-width: 350px; // 进一步限制最大宽度
    }
  }
  
  .platform-list {
    padding: 0 10px 30px;
    gap: 10px;
    flex-direction: column;
    align-items: center;
  }
}
.find-ability {
  min-height: 264px;
  background: url("~/assets/find-ability-bg.png") no-repeat;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  
  h3 {
    font-size: 36px;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.3;
    
    span {
      color: #f6be56;
    }
  }
  
  h4 {
    font-size: 24px;
    color: #fff;
    margin-bottom: 24px;
    line-height: 1.3;
  }
  
  button {
    width: 160px;
    height: 48px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 100px;
    border: 1px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    
    &:hover {
      background: #fff;
      color: #008571;
    }
  }
}

// 平板适配
@media (max-width: 1024px) {
  .find-ability {
    min-height: 240px;
    padding: 35px 30px;
    
    h3 {
      font-size: 32px;
    }
    
    h4 {
      font-size: 22px;
    }
    
    button {
      width: 150px;
      height: 45px;
      font-size: 15px;
    }
  }
}

// 手机适配
@media (max-width: 768px) {
  .find-ability {
    min-height: 220px;
    padding: 30px 20px;
    
    h3 {
      font-size: 28px;
      margin-bottom: 10px;
    }
    
    h4 {
      font-size: 20px;
      margin-bottom: 20px;
    }
    
    button {
      width: 140px;
      height: 42px;
      font-size: 14px;
    }
  }
}

// 小屏手机适配
@media (max-width: 480px) {
  .find-ability {
    min-height: 200px;
    padding: 25px 15px;
    
    h3 {
      font-size: 24px;
      margin-bottom: 8px;
    }
    
    h4 {
      font-size: 18px;
      margin-bottom: 18px;
    }
    
    button {
      width: 130px;
      height: 40px;
      font-size: 13px;
    }
  }
}
</style>
// 横屏手机适配
@media (max-height: 500px) and (orientation: landscape) {
  .top {
    min-height: 400px;
  }
  
  .top-title {
    margin-top: 0;
    
    .logo {
      width: 100px;
      height: 34px;
      margin-bottom: 10px;
    }
    
    h2 {
      font-size: 24px;
      line-height: 1.2;
      margin-bottom: 8px;
    }
    
    .to-m {
      margin-top: 15px;
    }
    
    .down-to {
      bottom: 60px;
    }
  }
  
  .top-data {
    height: 80px;
  }
}

// 平板横屏适配
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .top-title {
    h2 {
      font-size: 36px;
    }
  }
}

// 通用响应式优化
.seller-registration {
  * {
    box-sizing: border-box;
  }
  
  // 确保所有图片响应式
  img {
    max-width: 100%;
    height: auto;
  }
  
  // 确保文本不会溢出
  h1, h2, h3, h4, h5, h6, p, span {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

// 高分辨率屏幕优化
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .top {
    background-image: url("~/assets/seller-registration-bg@2x.png");
  }
  
  .find-ability {
    background-image: url("~/assets/find-ability-bg@2x.png");
  }
}

// 打印样式
@media print {
  .seller-registration {
    .top {
      background: none;
      color: #000;
      
      .top-title h2 {
        color: #000;
      }
    }
    
    .find-ability {
      background: none;
      color: #000;
      
      h3, h4 {
        color: #000;
      }
    }
  }
}